<template>
  <el-button type="primary" size="default" @click="addBtn">新增</el-button>

  <div>
    {{ count }}
  </div>
</template>

<script setup lang="ts">
import { testStore } from "@/store/text/index.ts"
import { computed } from "vue"

// 获取store
const store = testStore();
//cont展示到页面
const count = computed(()=>{
  return store.getCount;
});

//点击按钮改变count的值
const addBtn =()=>{
  //方式1
  // store.count++
  //方式2(常用)
  store.setCount(++store.count)
  //方式3
  // store.$patch({
  //   count:++store.count
  // })
  //方式4
  // store.$patch((state)=>{
  //   state.count = ++store.count
  // })
}
</script>

<style scoped>

</style>